@extends('articles.index'){{--继承articles/index.blade.php文件--}}
@section('description')
    <table class="table table-bordered">
        <caption>文章列表</caption>
        <thead>
        <tr>
            <th>ID</th>
            <th>标题</th>
            <th>内容</th>
            <th>编辑</th>
            <th>删除</th>
        </tr>
        </thead>
        <div>
            <a href="{{ route('articles.create') }}"><button type="submit" class="btn">新增</button></a>
        </div>
        <tbody>
        @foreach($articles as $article)
        <tr>
            <td>{{$article->id}}</td>
            <td>{{$article->title}}</td>
            <td>{{$article->content}}</td>
            <td> <a href="{{ route('articles.edit', $article->id) }}"><button type="button" class="btn">编辑</button></a></td>

            <td>
                <form action="{{ route('articles.destroy',$article->id) }}" method="post">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <input type="hidden" name="_method" value="delete">
                    <button type="submit" class="btn">删除</button>

                </form>
            </td>
        </tr>
        @endforeach
        </tbody>
    </table>
@endsection
